<template>
  <view>
	  <!-- 公共组件-每个页面必须引入 -->
	  <public-module></public-module>
      <view class="checkIn-business">
	     <u--form class="u-form" labelPosition="left" labelWidth='220rpx' :model="model1" :rules="rules" ref="uForm" errorType="toast" disabled>
			 <div style="height:32rpx;" v-if="model1.isUpgrade == 1"></div>
				<div class="form-bg" v-if="model1.isUpgrade == 1">
					<div class="checkIn-state" style="padding:40rpx 0;border-bottom:0;">
						<image src="https://pic.moresu.com/FhvjIwgEEswHK9MIl1-hgS7XErja"  style="vertical-align: middle;width: 60rpx;height: 59rpx;display: inline-block;" mode="aspectFit"></image>
						<span style="padding-left:20rpx;vertical-align: middle;">审核中</span>
						<div class="state-stext">由于您变更了店铺类型或实体经营地址照片，我们需要重新审核，审核结果会尽快电话通知您，请耐心等候！</div>
					</div>
				</div> 
			 <div style="height:32rpx;" ></div>
	       <div class="form-bg">
				   <u-form-item label="公司名称" borderBottom>
					   <div style="text-align: right;">{{model1.storeName}}</div>
				   </u-form-item>
				   <u-form-item label="统一信用码" borderBottom>
					   <div style="text-align: right;">{{model1.storeCode}}</div>
				   </u-form-item>
				   <u-form-item label="店铺类型" prop="storeType" :borderBottom="false" required v-if="model1.isUpgrade == 1">
				     <u--input v-model="model1.storeType" input-align="right" disabled disabledColor="#ffffff" placeholder="选择店铺类型"
				       border="none" style="pointer-events: none"></u--input>
				   </u-form-item>
				   
				   <u-form-item label="店铺类型" prop="storeType" :borderBottom="false"  @click='changeStore' required v-else>
				     <u--input v-model="model1.storeType" input-align="right" disabled disabledColor="#ffffff" placeholder="选择店铺类型"
				       border="none" style="pointer-events: none"></u--input>
				    <div  slot="right">
						<u-icon slot="right" name="arrow-right"></u-icon>
				    </div> 
				   </u-form-item>
				
				   <u-form-item label="公司LOGO"  borderBottom   v-if="model1.isUpgrade == 1">
					   <div style="text-align: right;">
						   <u-avatar :src="model1.storeLogo" :customStyle="{display: 'inline-block'}"></u-avatar>
					   </div>
				   </u-form-item>
				   <u-form-item label="公司LOGO"  borderBottom  @click="editAvatar" v-else>
					   <div style="text-align: right;">
						   <u-avatar :src="model1.storeLogo" :customStyle="{display: 'inline-block'}"></u-avatar>
					   </div>
						 <u-icon slot="right" name="arrow-right" ></u-icon>
				   </u-form-item>
				   <u-form-item label="主营品类" prop="mainBusiness" borderBottom  required>
				     <u--input v-model="model1.mainBusiness" input-align="right" disabled disabledColor="#ffffff" border="none" style="pointer-events: none"></u--input>
				   </u-form-item>
				  
				  <u-form-item label="公司地址" prop="storeArea" borderBottom required v-if="model1.isUpgrade == 1">
					   <div style="text-align: right;">{{model1.storeArea}}</div>
				 </u-form-item>
				 <u-form-item label="公司地址" prop="storeArea" borderBottom required v-else>
					  <uni-data-picker v-slot:default placeholder="请选择所在地区" popup-title="请选择所在地区" :localdata="dataTree"
						 :map="{text:'areaName',value:'areaId'}" @change="onchange" :clear-icon="false" style="width:100%">
						 <u--input v-model="model1.storeArea" input-align="right" disabled disabledColor="#ffffff"
						   placeholder="请选择所在地区" border="none"></u--input>
					   </uni-data-picker>
					   
					   <div  slot="right">
						   <u-icon slot="right" name="arrow-right" ></u-icon>
					   </div>
				 </u-form-item>
				 
				 <u-form-item label="详细地址" prop="storeAddress" borderBottom  required>
				   <u--input v-model="model1.storeAddress" input-align="right"  
					 placeholder="请输入详细地址" border="none" :disabled="model1.isUpgrade == 1"></u--input>
				 </u-form-item>
				 <u-form-item label="网址"  :borderBottom="false" >
				   <u--input v-model="model1.website" input-align="right"  
				 					 placeholder="请输入网址" border="none" :disabled="model1.isUpgrade == 1"></u--input>
				 </u-form-item>
			  </div>
			  <div style="height:32rpx;" ></div>
			  <div class="form-bg">
				  <u-form-item label="实体经营地址照片" prop="businessAddressImg" :borderBottom="false"   required labelPosition="top" labelWidth='300rpx'>
					  <div style="width:200rpx;margin:0 auto">
						  <image :src="model1.businessAddressImg" v-if="model1.businessAddressImg && model1.isUpgrade == 1" style="width:200rpx;height:200rpx;"></image>
						  
						  <u-upload url="https://upload.qiniup.com" :fileList="fileList1" @afterRead="handleAfterRead($event,'businessAddressImg')"
								name="2"  :maxCount="1" style="width:200rpx;height:200rpx;" v-else-if="model1.isUpgrade != 1">
								<image :src="model1.businessAddressImg" v-if="model1.businessAddressImg" style="width:200rpx;height:200rpx;"></image>
								<div v-else style="border:1px solid #eee;width:200rpx;height:200rpx;margin:0 auto;display: flex;justify-content: center;align-items: center;">
								  <u-icon name="plus" size="30"></u-icon>
								</div>
						  </u-upload>
					  </div>
					  <div style="padding:10rpx 0;text-align: center;font-size:24rpx;" >与营业执照抬头内容相同实体经营门面照片或工厂大门照片</div>
				  
				  </u-form-item>
			  </div>
			  <div v-if="model1.isUpgrade != 1">
				  <!--生产厂家-->
				  <div style="height:32rpx;" v-if="storeType == 1"></div>
				  <div class="form-bg" v-if="storeType == 1">
				    <u-form-item label="授权书" prop="empowerBook" :borderBottom="false"   required labelPosition="top">
				  	  <div style="width:200rpx;margin:0 auto">
				  		  <u-upload url="https://upload.qiniup.com" :fileList="fileList1" @afterRead="handleAfterRead($event,'empowerBook')" 
				  			name="2"  :maxCount="1" style="width:200rpx;height:200rpx;">
				  			<image :src="model1.empowerBook" v-if="model1.empowerBook" style="width:200rpx;height:200rpx;"></image>
				  			<div v-else style="border:1px solid #eee;width:200rpx;height:200rpx;margin:0 auto;display: flex;justify-content: center;align-items: center;">
				  			  <u-icon name="plus" size="30"></u-icon>
				  			</div>
				  		  </u-upload>
				  		  <div style="padding:10rpx 0;text-align: center;font-size:24rpx;color:#FF5E01" @click="downImg">下载授权书模板</div>
				  	  </div>
				  	  <div style="padding:10rpx 0;text-align: center;font-size:24rpx">工厂盖章的授权书内容参考下载的授权书模板</div>
				    </u-form-item>
				  </div>
				  <!--品牌代理-->
				  <div v-if="storeType == 2">
				  	  <div style="height:32rpx;"></div>
				  	  <div class="form-bg">
				  		  <u-form-item label="品牌代理证明" prop="brandAgency" :borderBottom="false"   required labelPosition="top">
				  			  <div style="width:200rpx;margin:0 auto">
				  				  <u-upload url="https://upload.qiniup.com" :fileList="fileList1" @afterRead="handleAfterRead($event,'brandAgency')" 
				  					name="3"  :maxCount="1" style="width:200rpx;height:200rpx;">
				  					<image :src="model1.brandAgency" v-if="model1.brandAgency" style="width:200rpx;height:200rpx;"></image>
				  					<div v-else style="border:1px solid #eee;width:200rpx;height:200rpx;margin:0 auto;display: flex;justify-content: center;align-items: center;">
				  					  <u-icon name="plus" size="30"></u-icon>
				  					</div>
				  				  </u-upload>
				  			  </div>
				  		  <div style="padding:10rpx 0;text-align: center;font-size:24rpx">生产厂家授权的代理证或加盖生产厂家公章的授权经销资料</div>
				  		  </u-form-item>
				  	  </div>
				  </div>
				  <!--优质贸易商-->
				  <div v-if="storeType == 3">
					  <div style="height:32rpx;"></div>
					  <div class="form-bg">
						  <u-form-item label="采购渠道证明" prop="procurementChannels" :borderBottom="false"   required labelPosition="top">
							  <div style="width:200rpx;margin:0 auto">
								  <u-upload url="https://upload.qiniup.com" :fileList="fileList1" @afterRead="handleAfterRead($event,'procurementChannels')" 
									name="4"  :maxCount="1" style="width:200rpx;height:200rpx;">
									<image :src="model1.procurementChannels" v-if="model1.procurementChannels" style="width:200rpx;height:200rpx;"></image>
									<div v-else style="border:1px solid #eee;width:200rpx;height:200rpx;margin:0 auto;display: flex;justify-content: center;align-items: center;">
									  <u-icon name="plus" size="30"></u-icon>
									</div>
								  </u-upload>
							  </div>
							  <div style="padding:10rpx 0;text-align: center;font-size:24rpx">具有生产厂家与申请方盖章的原料购销合同或有双方抬头的购销发票证明</div>
						  
						  </u-form-item>
					  </div>
				  </div> 
			  </div>
			  
			  <div v-else>
				  <div style="height:32rpx;"></div>
				  <div class="form-bg">
					  <u-form-item label=" "  labelWidth="0" borderBottom v-if="storeType == 1">
							   <image @click="preview(model1.empowerBook)" :src="model1.empowerBook ? model1.empowerBook : 'https://pic.gxmore.com/FiqGX7sq-tf7AxckbXJHCroBW1Pv'"  style="width: 414rpx;height: 270rpx;margin:0 auto" mode="aspectFit"></image>
							   <div style="font-size:28rpx;padding-top:20rpx;text-align: center;font-weight: bold;">授权书</div>
					  </u-form-item>
					  <u-form-item label=" " borderBottom labelWidth="0" v-if="storeType == 2">
								<image @click="preview(model1.brandAgency)" :src="model1.brandAgency ? model1.brandAgency : 'https://pic.gxmore.com/FiqGX7sq-tf7AxckbXJHCroBW1Pv'"  style="width: 414rpx;height: 270rpx;margin:0 auto" mode="aspectFit"></image>
							   <div style="font-size:28rpx;padding-top:20rpx;text-align: center;font-weight: bold;">品牌代理证明</div>
					  </u-form-item>
					  
					  <u-form-item label=" " borderBottom labelWidth="0" v-if="storeType == 3">
							<image @click="preview(model1.procurementChannels)" :src="model1.procurementChannels ? model1.procurementChannels : 'https://pic.gxmore.com/FiqGX7sq-tf7AxckbXJHCroBW1Pv'"  style="width: 414rpx;height: 270rpx;margin:0 auto" mode="aspectFit"></image>
						   <div style="font-size:28rpx;padding-top:20rpx;text-align: center;font-weight: bold;">采购渠道证明</div>
					  </u-form-item>  
				  </div>
			  </div>
			
				  
			  <div style="padding:24rpx;font-size:28rpx;font-weight: bold;">开票信息</div>
			  <div class="form-bg">
				  <u-form-item label="注册地址" borderBottom  >
				    <u--input v-model="model1.registerAddress" input-align="right"  
				  					 placeholder="请输入开票信息注册地址" border="none" :disabled="model1.isUpgrade == 1"></u--input>
				  </u-form-item>
				  <u-form-item label="联系电话"  borderBottom >
						<u--input  v-model="model1.invoicePhone" input-align="right"  placeholder="请输入开票信息联系电话" border="none" :disabled="model1.isUpgrade == 1"></u--input>
				  </u-form-item>
				  <u-form-item label="开户行" borderBottom >
						<u--input  v-model="model1.bankName" input-align="right"   placeholder="请输入开票信息开户行" border="none" :disabled="model1.isUpgrade == 1"></u--input>
				  </u-form-item>
				  <u-form-item label="银行帐号"  :borderBottom="false" >
						<u--input  v-model="model1.bankNumber" input-align="right" 
						  placeholder="请输入开票信息银行帐号" border="none" :disabled="model1.isUpgrade == 1"></u--input>
				  </u-form-item>
			  </div>
	  	      <div style="padding:24rpx;font-size:28rpx;font-weight: bold;">联系信息</div>
			  <div class="form-bg">
				  <u-form-item label="联系人" prop="contactPerson" borderBottom required>
						<u--input v-model="model1.contactPerson" input-align="right"  placeholder="请输入联系人" border="none" :disabled="model1.isUpgrade == 1"></u--input>
				  </u-form-item>
				  <u-form-item label="联系人电话" prop="storePhone" :borderBottom="false" required>
						<u--input v-model="model1.storePhone" input-align="right"   placeholder="请输入联系人电话" border="none" :disabled="model1.isUpgrade == 1"></u--input>
				  </u-form-item>
			  </div>
			  
			  <div v-if="model1.isUpgrade == 1">
				  <div v-for="item in imgList" :key="item.id" >
					  <div style="height:32rpx;"></div>
					  <div class="form-bg">
						  <u-form-item :label="item.name"  :borderBottom="false"  labelPosition="top">
							  <div style="margin-top:20rpx;display: flex;flex-direction: row;flex-wrap: wrap;flex: 1;">
								 <div v-for="ee in item.list" :key="ee"  style="border-radius: 2px;margin: 0 8px 8px 0;position: relative;overflow: hidden;display: flex;flex-direction: row;">
									  <image  :src="ee.url"  style="width: 160rpx;height: 160rpx;margin-right:10px;" mode="aspectFit"></image>
								 </div>	
							  </div>
						 </u-form-item>
					  </div>
				  </div>
			  </div>
			  
			  <div v-else>
				  <div v-for="item in imgList" :key="item.id">
					  <div style="height:32rpx;"></div>
					  <div class="form-bg">
						  <u-form-item :label="item.name"  :borderBottom="false"  labelPosition="top">
							  <div style="margin-top:20rpx" >
								  <u-upload url="https://upload.qiniup.com" @delete="deleteImg($event,item.id)" :maxCount="6" :fileList="item.list" @afterRead="handleAfterRead2($event,item.id)"></u-upload>
								  <div style="text-align: center;font-size: 24rpx;padding:24rpx 0">最多上传6张图片</div>
							  </div>
						 </u-form-item>
					  </div>
				  </div>
			  </div>  
	   </u--form>
      <view class="checkIn-auth-button" style="z-index: 5;" v-if="model1.isUpgrade != 1">
         <u-button type="primary" shape="circle" @click="addEditStore">保存</u-button>
      </view>
    </view>
	
   <!-- 公司类型 -->
   <u-picker :show="showStoreType" :columns="columns" keyName="value" @confirm='confirmStoreType'
     @cancel='cancelStoreType'></u-picker>
	 
   <!--品名-->
   <category ref="category" @chooseItem="chooseCategory"></category>
   
   <!-- 裁剪图片的插件 -->
   <ksp-cropper mode="fixed" :width="160" :height="160" :maxWidth="1024" :maxHeight="1024" :url="url1"
     @cancel="url1 = ''" @ok="onok"></ksp-cropper>
  </view>
</template>

<script>
  import category from '@/components/module/category';
  import {
    getLicenseIdentify,
    editStore,
    storeDetail,
    mainBusiness,
	
  } from '@/config/api2.js'
  import {
    getAreaList,checkBusinessLicense,downLoadEmpower,getStoreType
  } from '@/config/api.js'
  import {
    imgCheck
  } from '@/plugins/upload/upload.js'
  import {downloadFun} from '@/plugins/utils.js'
  const md5 = require('../../plugins/md5.min.js');
  const defaultForm = {
	  storeId: '',
	  storeName: '', //商家名称
	  storeCode: '', //商家信用代码
	  mainBusiness: '', //主营业务
	  storeType: '', //类型:0普通用户,1生产企业，2贸易企业
	  contactPerson: '', //联系人
	  registerAddress: '', //注册地址
	  storePhone: '', //联系电话
	  bankName: '', //开户行名称
	  bankNumber: '', //开户行银行卡号
	  storeAddress:'',
	  storeArea:'',
	  invoicePhone:'',
	  storeAlbum:[],//公司相册
	  storeLogo:'',
	  website:'',
	  businessAddressImg:'',
	  isUpgrade:'',
	  
	  empowerBook:'',//授权书
	  brandAgency:'',//品牌代理
	  procurementChannels:'',//采购渠道
  }
  export default {
    data() {
      return {
        fileList1: [],
        storeId: 0,
        list: [],
        mainBusiness: [],
        mainBusinessLi: [],
		model1: JSON.parse(JSON.stringify(defaultForm)),
		rules: {
		 'registerAddress': {
		    type: 'string',
		    required: true,
		    message: '请输入开票信息注册地址',
		    trigger: ['blur', 'change']
		  },
		  'storeArea': {
		    type: 'string',
		    required: true,
		    message: '请选择所在地区',
		    trigger: ['blur', 'change']
		  },
		  'storeAddress': {
		    type: 'string',
		    required: true,
		    message: '请输入详细地址',
		    trigger: ['blur', 'change']
		  },
		  'invoicePhone':[{
		    type: 'string',
		    required: true,
		    message: '请输入开票信息联系电话',
		    trigger: ['blur', 'change']
		  },{
			  validator: (rule, value, callback) => {
					// 上面有说，返回true表示校验通过，返回false表示不通过
					// uni.$u.test.mobile()就是返回true或者false的
					return uni.$u.test.contains(value,'/[^\0-9.-]/g');
				},
				message: '手机号码不正确',
				// 触发器可以同时用blur和change
				trigger: ['change','blur'],
		  }],
		  'bankName': {
		    type: 'string',
		    required: true,
		    message: '请输入开户行',
		    trigger: ['blur', 'change']
		  },
		  'bankNumber': {
		    type: 'string',
		    required: true,
		    message: '请输入开户行帐号',
		    trigger: ['blur', 'change']
		  },
		  'contactPerson': {
		    type: 'string',
		    required: true,
		    message: '请输入联系人',
		    trigger: ['blur', 'change']
		  },
		  'storePhone': [{
		    type: 'string',
		    required: true,
		    message: '请输入联系人电话',
		    trigger: ['blur', 'change']
		  },{
			pattern: /^[0-9.()-]+$/,
			// 正则检验前先将值转为字符串
			transform(value) {
				return String(value);
			},
			message: '电话号码只能包含数字与-号'
			},
		  ],
		  'mainBusiness': {
		    type: 'string',
		    required: true,
		    message: '请选择主营业务',
		    trigger: ['blur', 'change']
		  },
		  'storeType': {
		    type: 'string',
		    required: true,
		    message: '选择店铺类型',
		    trigger: ['blur', 'change']
		  },
		  'businessAddressImg':{
			  type: 'string',
			  required: true,
			  message: '请上传实体经营地址照片',
			  trigger: ['blur', 'change']
		  },
		  'empowerBook': {
		    type: 'string',
		    required: true,
		    message: '请上传授权书',
		    trigger: ['blur', 'change']
		  },
		  'brandAgency': {
		    type: 'string',
		    required: true,
		    message: '请上传品牌代理文件',
		    trigger: ['blur', 'change']
		  },
		  'procurementChannels': {
		    type: 'string',
		    required: true,
		    message: '请上传采购渠道文件',
		    trigger: ['blur', 'change']
		  },
		},
		dataTree:[],
		storeType:'',
		url1:'',
		imgList:[],
		
		showStoreType:false,
		columns: [],
		wordFile:'',
      }
    },
    onLoad() {
      this.getStoreDetail()
	  this.getDataList()
	  this.columns = [];
	  downLoadEmpower().then((res)=>{
		  this.wordFile = res.fileUrl
	  })
	  // #ifdef MP
		this.$refs.uForm.setRules(this.rules)
		// #endif
    },
    components: {
      category
    },
    methods: {
		preview(url){
			uni.previewImage({urls: [url]});
		},
		// 下载
		downImg() {
			downloadFun(this.wordFile)
		},
		// 点击选择公司类型
		changeStore() {
				this.showStoreType = true
		},
		// 公司类型选择确定后触发
		confirmStoreType(e) {
		  console.log('e3', e)
		  this.model1.storeType = e.value[0].value
		  this.storeType = e.value[0].id
		  this.showStoreType = false
		},
		cancelStoreType(e) {
		  this.showStoreType = false
		},
		handleAfterRead(event,key) {
			if(event.file.size>2*1024*1000){
				uni.showToast({
					title:'图片大小超过2M，请重新选择照片',
					icon:'none'
				})		
				return
			}
			uni.showLoading({
				title: '上传中',
			});
			console.log("event",event)
			console.log("key",key)
			imgCheck(event.file.url).then((res)=>{
				if(res != ''){
					this.model1[key] = res;
					if(key == 'storeBusinessLicense'){
						const licensePicUrl = res;
						// 生成签名串
						const encryption = md5(licensePicUrl + "gxmore..!");
						this.getLicenseIdentifys(licensePicUrl, encryption)
					}
					
				}
				uni.hideLoading()
			}).catch(()=>{
				uni.hideLoading()
			})
		},
		
		editAvatar() {
		  let _this = this
		  uni.chooseImage({
		    count: 1,
		    success(res) {
		      console.log('res', res)
		      _this.url1 = res.tempFilePaths[0]
		    }
		  })
		},
		
		// 头像裁剪完成
		onok(e) {
		  imgCheck(e.path).then(async (res) => {
		    if (res != '') {
		      // 获取上传成功后的图片地址
		      this.model1.storeLogo = res
		    }
		  })
		  this.url1 = '' // 清空 url 关闭裁剪页
		},
		
		
	    //地址信息
		getDataList() {
		  getAreaList({
		    custom: false
		  }).then((res) => {
		    this.dataTree = res;
		  })
		},
		
		onchange(e) {
				let ids = [];
				let txts = [];
				e.detail.value.forEach((item) => {
				  txts.push(item.text)
				  ids.push(item.value)
				});
				// this.provinceId = ids[0] ? ids[0] : ''
				// this.cityId = ids[1] ? ids[1] : ''
				// this.areaId = ids[2] ? ids[2] : ''
				this.model1.storeArea = txts.join(" ")
			
		},
		
		//主营
		showMainBu() {
		   this.$refs.category.init('more', this.list,this.storeType);	  
		},
		
		
		//选择品名
		chooseCategory(list) {
		  this.list = list
		  this.mainBusinessLi = []
		  const arr1 = []
		  list.forEach(item => {
		    this.mainBusinessLi.push(item.categoryId)
		    arr1.push(item.categoryName)
		  })
		  this.model1.mainBusiness = arr1.join(',')
		},
		
		//上传图片
		handleAfterRead2(event,id) {
			if(event.file.size>2*1024*1000){
				uni.showToast({
					title:'图片大小超过2M，请重新选择照片',
					icon:'none'
				})		
				return
			}
			uni.showLoading({
				title: '上传中',
			});
			imgCheck(event.file.url).then((res)=>{
				let i = this.imgList.findIndex((el)=>{
					return el.id == id
				});
				console.log("i",i)
				let c ;
				if(i != -1){
				    c = JSON.parse(JSON.stringify(this.imgList[i]));
					c.list.push({url:res})
				}
				this.imgList.splice(i,1,c)
				uni.hideLoading()
			}).catch(()=>{
				uni.hideLoading()
			})
		},
		
		//删除图片
		deleteImg(event,id){
			console.log(event)
			console.log(id)
			let i = this.imgList.findIndex((el)=>{
				return el.id == id
			});
			let c ;
			if(i != -1){
			    c = JSON.parse(JSON.stringify(this.imgList[i]));
				c.list.splice(event.index,1)
			}
			this.imgList.splice(i,1,c)
		},
		
      addEditStore() {
        let data = JSON.parse(JSON.stringify(this.model1))
		data.storeType = this.storeType;
		data.mainBusiness = this.mainBusinessLi;
		data.storeAlbum = [];
		this.imgList.forEach((e)=>{
			e.list.forEach((ee)=>{
				data.storeAlbum.push({albumType:e.id,imgUrl:ee.url})
			})
		})
		console.log("data",data)
		this.$refs.uForm.validate().then(res => {
		  editStore(data).then(res => {
		    uni.$u.toast('提交成功')
			this.getStoreDetail()
		  })
		}).catch(errors => {
	 
		}) 

      },
      
      getStoreDetail() {
        storeDetail().then(res => {
			if(res){
				getStoreType({storeType:res.storeType}).then((res)=>{
					  this.columns = []
					  this.columns.push(res)
				})
				this.imgList = []
			    for(let key  in defaultForm){
				    this.model1[key] = res[key] ? res[key] : defaultForm[key]
				}
				// this.model1 = JSON.parse(JSON.stringify(res))
				this.model1.mainBusiness = res.mainBusinessStr ? res.mainBusinessStr.join(',') : '';
				console.log("res.mainBusiness",res.mainBusiness)
				this.mainBusinessLi = res.mainBusiness
				res.mainBusiness.forEach((item, index) => {
				  this.list.push({
				    categoryId: item,
				    categoryName: res.mainBusinessStr[index]
				  })
				});
				this.storeType = res.storeType;
				if(this.storeType == 1){
					this.model1.storeType = '生产厂家'
				}else if(this.storeType == 2){
					this.model1.storeType = '品牌代理'
				}else if(this.storeType == 3){
					this.model1.storeType = '优选供应商'
				}else if(this.storeType == 4){
					this.model1.storeType = '普通供应商'
				}
				res.albumType.forEach((el)=>{
					let list = [];
					let list2 = [];
					list = res.storeAlbum.filter((item)=>{
						return item.albumType == el.id
					})
					list.forEach((el)=>{
						list2.push({url:el.imgUrl})
					})
					this.imgList.push({name:el.name,id:el.id,list:list2})	
				});
				console.log(this.imgList)
			}
        })
      }
    },

  }
</script>

<style lang="scss">
  @import '@/style/wmj.scss';
  .checkIn-state{
  		  padding:40rpx;
  		  border-bottom:2rpx dashed #DEDEDE;
  		  text-align: center;
  		  font-weight: bold;
  		  .state-stext{
  			  font-size:24rpx;
  			  color:#888;
  			  text-align: center;
  			  padding:32rpx;
  			  font-weight: 400;
  		  }
  }
  .checkIn-info{
	  background: linear-gradient(180deg, #fffbf5 0%, #FFFFFF 10%);
	  box-shadow: 0px 0px 10px rgba(0,17,52,0.09);
	  padding:32rpx;
	  padding-bottom:160rpx;
	  
  }
   .checkIn-business{
	   padding:0 32rpx;
	   padding-bottom:160rpx;
	   .form-bg{
		   background: #fff;
		   border-radius: 18rpx;
		   box-shadow: 0px 0px 15rpx rgba(0,17,52,0.15);
		   padding:0 32rpx;
	   }
   }
  .content-top {
    .row {
      width: 100%;
      padding: 0 24rpx;
      border-top: solid 1upx #eee;

      .nominal {
        width: 30%;
        height: 90upx;
        font-size: 30upx;
        text-align: left;
        line-height: 90upx;
      }

      .input {
        width: 100%;
        padding: 20upx 0;
        align-items: center;
        font-size: 30upx;
        text-align: right;

      }



    }
  }

  .butoon-bottom {
    width: 100%;
    padding: 20px;
    position: fixed;
    bottom: 0;
  }

  .mainBu-content {
    display: flex;
    padding: 0;

    .mainBu-content-left {
      border-right: 1px solid #cccccc;

      .scroll-view-y {
        min-height: 300px;

        .button {
          margin: 14px 20px 25px 10px;
          padding-bottom: 5px;
          font-size: 26rpx;
          color: #929292;
        }

        .active {
          border-bottom: 2px solid #FF5E01;
          color: #FF5E01;
        }
      }

    }

    .mainBu-content-right {
      padding: 0 !important;

      .scroll-view-y {
        height: 300px;



        .right-text {
          margin: 5px 10px;
          display: inline-block;
          font-size: 26rpx;
          color: #ababab;

          view {
            padding: 5px;
          }
        }

        .choonse {
          color: #FF5E01;
        }
      }

      width: 200px;
      flex: 1;
      padding: 20px;



    }
  }
</style>